//
//  TYCyclePagerViewCell.m
//  TYCyclePagerViewDemo
//
//  Created by tany on 2017/6/14.
//  Copyright © 2017年 tany. All rights reserved.
//

#import "TYCyclePagerViewCell.h"
#import "UIImage+EMGIF.h"
#import <UIImageView+WebCache.h>

@interface TYCyclePagerViewCell ()
@property (nonatomic, weak) UIImageView *img;
@end

@implementation TYCyclePagerViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor clearColor];
        [self addImage];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    if (self = [super initWithCoder:aDecoder]) {
        self.backgroundColor = [UIColor clearColor];
        [self addImage];
    }
    return self;
}

- (void)addImage {
    UIImageView *img = [[UIImageView alloc]init];
    img.contentMode = UIViewContentModeScaleAspectFill;
    img.image = [UIImage imageNamed:@"正面1"];
    img.layer.cornerRadius = 5.0;
    img.clipsToBounds = YES;
    [self.contentView addSubview:img];
    self.img = img;
}
- (void)setRadio:(float)radio
{
    _radio = radio;
    self.img.layer.cornerRadius = radio;
}
- (void)setImagePlace:(NSString *)imagePlace
{
    _imagePlace = imagePlace;
    [self.img sd_setImageWithURL:[NSURL URLWithString:imagePlace] placeholderImage:GetImage(@"timg1")];
}
- (void)setModel:(BannerModel *)model
{
    _model = model;
    [self.img sd_setImageWithURL:[NSURL URLWithString:model.bannerUrl] placeholderImage:GetImage(@"timg1")];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.img.frame = self.bounds;
}

@end
